import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router);
const Recommend = ((resolve) => {
  import('../components/recommend/recommend').then((model) => {
    resolve(model)
  })
})

const Singer = ((resolve) => {
  import('../components/singer/singer').then((model) => {
    resolve(model)
  })
})

const Rank = ((resolve) => {
  import('../components/rank/rank').then((model) => {
    resolve(model)
  })
})

const Search = ((resolve) => {
  import('../components/search/search').then((model) => {
    resolve(model)
  })
})

const singerDetail = ((resolve) => {
  import('../components/singerDetail/singerDetail').then((model) => {
    resolve(model)
  })
})

const Disc = ((resolve) => {
  import('../components/disc/disc').then((model) => {
    resolve(model)
  })
})

const TopList = ((resolve) => {
  import('../components/top-list/top-list').then((model) => {
    resolve(model)
  })
})

const userCenter = ((resolve) => {
  import('../components/user-center/user-center').then((model) => {
    resolve(model)
  })
})
export default new Router({
  routes: [
    //默认到推荐页面
    {
      path:'/',
      redirect:'/recommend'
    },
    {
      path:'/recommend',
      component:Recommend,
      children:[
        {
          path:':id',
          component:Disc
        }
      ]
    },
    {
      path:'/singer',
      component:Singer,
      children:[
        {
          path:':id',
          component:singerDetail
        }
      ]
    },
    {
      path:'/search',
      component:Search,
      children:[
        {
          path:':id',
          component:singerDetail
        }
      ]
    },
    {
      path:'/rank',
      component:Rank,
      children:[
        {
          path: ':id',
          component:TopList
        }
      ]
    },
    {
      path:'/user',
      component:userCenter
    }
  ]
})
